#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2019/2/13 14:31
@desc
"""

import os
import time


def gen_pid_file(pid):
    with open('fork.PID', 'w') as f:
        f.write(pid)

res = os.fork()
print('res == %d'%res)
if res == 0:
    print('我是子进程,我的pid是:%d,我的父进程id是:%d'%(os.getpid(),os.getppid()))
    gen_pid_file(os.getpid())
else:
    print('我是父进程,我的pid是:%d'%os.getpid())